﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using Modules.Core;
using Modules.Library.Entities;

namespace ComputerStoreManager.ViewModel {
    public delegate void OnCustomerControlAddCustomerEventHander();
    public delegate void OnCustomerControlViewCustomerEventHander();
    public class CustomerControlViewModel : BaseViewModel {

        #region Variables
        private bool m_isVisibleCustomerLeftPanel = false;
        #endregion

        #region Icommand
        public ICommand AddCustomerCommand {
            get;
            private set;
        }
        public ICommand ViewCustomerCommand {
            get;
            private set;
        }
        #endregion

        #region Events
        public event OnCustomerControlAddCustomerEventHander OnAddCustomerClicked;
        public event OnCustomerControlViewCustomerEventHander OnViewCustomerClicked;
        #endregion

        #region Properties
        public bool IsVisibleCustomerLeftPanel {
            get {
                return m_isVisibleCustomerLeftPanel;
            }
            set {
                m_isVisibleCustomerLeftPanel = value;
                OnPropertyChanged("IsVisibleCustomerLeftPanel");
            }
        }
        #endregion

        #region Constructor
        public CustomerControlViewModel() {
            InitCmd();
        }
        #endregion


        #region Methods
        public void InitCmd() {
            AddCustomerCommand = new ExecutableCommand(DoAddCustomer);
            ViewCustomerCommand = new ExecutableCommand(DoViewCustomer);
        }

        public void DoAddCustomer() {
            if (OnAddCustomerClicked != null) {
                OnAddCustomerClicked();
            }
        }

        public void DoViewCustomer() {
            if (OnViewCustomerClicked != null) {
                OnViewCustomerClicked();
            }
        }
        #endregion
    }
}
